package MyGui;

import javax.swing.*;
import java.awt.event.*;

import DistSys.SysConst;

public class MyPopupMenu extends JPopupMenu {
    MainFrame mainFrame;

    private JMenuItem cmpInfo, cmpInfoDebug, rotate, toggle, delete, copy;

    public MyPopupMenu(MainFrame mainFrame) {
        this.mainFrame = mainFrame;
        try {
            cmpInfo = new JMenuItem("Component Information...");
            cmpInfo.addActionListener(mainFrame.menuBar.alCmpInfo);
            cmpInfo.setFont( GuiConst.fontDefault);
            add(cmpInfo);

            if (SysConst.DEBUG_MODE > 0) {
                cmpInfoDebug = new JMenuItem("Connectivity ...");
                cmpInfoDebug.addActionListener(mainFrame.menuBar.alCmpInfoDebug);
                cmpInfoDebug.setFont( GuiConst.fontDefault);
                add(cmpInfoDebug);
            }

            addSeparator();

            rotate = new JMenuItem("Rotate");
            rotate.addActionListener(mainFrame.menuBar.alRotate);
            rotate.setFont( GuiConst.fontDefault);
            add(rotate);

            toggle = new JMenuItem("Toggle");
            toggle.addActionListener(mainFrame.menuBar.alToggle);
            toggle.setFont( GuiConst.fontDefault);
            add(toggle);

            delete = new JMenuItem("Delete");
            delete.addActionListener(mainFrame.menuBar.alDelete);
            delete.setFont( GuiConst.fontDefault);
            add(delete);

            copy = new JMenuItem("Copy");
            copy.addActionListener(mainFrame.menuBar.alCopy);
            copy.setFont( GuiConst.fontDefault);
            add(copy);
        }
        catch(Exception e) {
            e.printStackTrace();
        }
    }
}